﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
 
using System.Text;
using System.Windows.Forms;

namespace Skipette
{
    public partial class ProfileView : Form
    {
        public ProfileView()
        {
            InitializeComponent();
            int i = 1930;
            while (i < 2012)
            {
                comboBoxYear.Items.Add(i);
                i++;
            }
            LoadFromAcc(Program.currentProfile);
        }

        public ProfileView(Account acc)
        {
            InitializeComponent();
            LoadFromAcc(acc);
            buttonApply.Hide();
        }

        public ProfileView(String userName)
        {
            InitializeComponent();
            LoadFromUname(userName);
            buttonApply.Hide();
        }

        private void LoadFromAcc(Account acc)
        {
            this.pictureBoxAvatar.BackgroundImage = Server.GetProfilePic(acc.username);
            this.textBoxName.Text = acc.firstName;
            this.textBoxSurname.Text = acc.surname;
            this.textBoxFrom.Text = acc.from;
            this.textBoxLocation.Text = acc.location;
            this.textBoxUname.Text = acc.username;
            this.textBoxAbout.Text = acc.about;
            this.textBoxStatusMessage.Text = acc.statusMessage;
        }

        private void LoadFromUname(String username)
        {
            this.pictureBoxAvatar.BackgroundImage = Server.GetProfilePic(username);
            Account acc = Server.GetAccount(username);
            this.textBoxName.Text = acc.firstName;
            this.textBoxSurname.Text = acc.surname;
            this.textBoxFrom.Text = acc.from;
            this.textBoxLocation.Text = acc.location;
            this.textBoxUname.Text = acc.username;
            this.textBoxAbout.Text = acc.about;
            this.textBoxStatusMessage.Text = acc.statusMessage;
        }

        private void buttonApply_Click(object sender, EventArgs e)
        {

        }
    }
}
